home *** CD-ROM | disk | FTP | other *** search
-
- ;Horizontal Starfield with SineWave Logo
- ;
- ;Programmed by : Bruce Henderson (BaH) 07.03.1999
-
- ; Includes segments of code by
- ; Mikkel Loekke, aka. FlameDuck,
- ; (explosion & sine demo)
- ; and Paul West (for Particle changes in Explosion demo)
-
- ; Runs at 25fps on 060/50
-
- WBStartup
- NoCli
-
-
- NEWTYPE .point
- x.w
- y.w
- End NEWTYPE
- NEWTYPE .point2
- xspeed.w
- yspeed.w
- End NEWTYPE
-
- #numpnts=255 ; Points set for each horizontal line.
- degrad.q = Pi/180 ; Degree/Radian Converter
-
- Dim pnt.point (#numpnts)
- Dim pnt2.point2 (#numpnts)
-
- Dim Lookup(460) ; Setup our sine lookup table.
- For i=0 To 460
- Lookup(i)=Sin((i)*degrad*2)*20
- Next
-
- DEFTYPE.l
-
- MCPU Processor ; Tell Mildred which CPU it should use.
- Mc2pCPUmode Processor ; Tell Mildred which CPU it should use for c2p.
-
- MReserveBitmaps 2 ; Tell Mildred that we're going to use 3 chunky bitmaps.
- MReservec2pWindows 1 ; Tell it we only need one c2p display.
-
- InitBank 0,320*256,$10000
- CludgeBitMap 2,320,256,8,Bank(0)
- LoadBitMap 2,"Logo.IFF"
- MBitmap 1,320,256 ; This will contain our chunky buffer.
-
- MPlanar16ToBitmap 1,Bank(0),320,256,320,256
-
-
-
- .initgraphics
- MBitmap 0,320,256 ; This will contain our chunky buffer.
-
- Mc2pWindow 0,320,256 ; Setup structures for c2p conversions.
-
- Dim bm.l(1) ; We use two bitmaps for double buffering
-
- For l=0 To 1
- ; Get some free CHIP memory
- bm(l)=AllocMem(320*256,$10002)
- If bm(l) ; and if we succeed
- ; make it a planar bitmap.
- CludgeBitMap l,320,256,8,bm(l)
- Else
- End
- EndIf
- Next l
-
- Dim scrtaglst.TagItem(7) ; All this stuff sets up our
- scrtaglst(0)\ti_Tag = #SA_Left ; Taglist for the screen we
- scrtaglst(0)\ti_Data = 0 ; want.
- scrtaglst(1)\ti_Tag = #SA_Depth
- scrtaglst(1)\ti_Data = 8
- scrtaglst(2)\ti_Tag = #SA_Width
- scrtaglst(2)\ti_Data = 320
- scrtaglst(3)\ti_Tag = #SA_Height
- scrtaglst(3)\ti_Data = 256
- scrtaglst(4)\ti_Tag = #SA_BitMap
- scrtaglst(4)\ti_Data = Addr BitMap (0)
- scrtaglst(5)\ti_Tag = #SA_ShowTitle
- scrtaglst(5)\ti_Data = 0
- scrtaglst(6)\ti_Tag = #SA_Draggable
- scrtaglst(6)\ti_Data = 0
- scrtaglst(7)\ti_Tag = #TAG_END ; The most important tag of them all.
-
- ScreenTags 0,"MildredDEMO",&scrtaglst(0) ; Open our intuition screen.
-
- DecodePalette 0,?incpal ; Get our IncBin'ed palette info.
- ShowPalette 0 ; Attach our palette to the screen.
-
-
- MParticleFormat 0
-
- For t.l=0To #numpnts ; Set up the starfield
- pnt(t)\x=Rnd(319)+1
- pnt(t)\y=t
- pnt2(t)\xspeed=(Rnd(5)+1)*-1 ; Some random Speeds. (Remove *-1 to reverse)
- pnt2(t)\yspeed=0
- Next
-
- pge=0
-
- Repeat ; Repeat our mainloop ....
- deg+4
- If deg>358
- deg=0
- EndIf
-
- Mc2p bm(pge) ; Double Buffer
- ShowBitMap pge
- WaitTOF_ ; Smooooooth...
- pge=1-pge
- MCls
-
- MAddToParticles &pnt(0)\x,#numpnts,&pnt2(0)\xspeed ; Move the Stars
- MWrapParticles &pnt(0)\x,#numpnts ; If a Star falls off the end, put it back on the other side;
- MPlotParticles &pnt(0)\x,#numpnts,255 ; Draw them.
-
- For y=0 To 99 Step 2 ; Do the sine wavey bits.
- MScroll 0,y,100,2,100+Lookup(deg+y),70+y,1 ; Offset each line of our Logo with the Sinewave
- Next
-
- Until RawStatus($45) ; .... Until we press Escape
- End ; End of program.
-
- Even ; put following data on an even address. Minor speed increase.
- .incpal
- IncBin "Logo.PAL" ; Include our palette information in the binary.
-